<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>三会一课</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/assets/amazeui.widgets.helper.min.js"></script>
    <script src="/js/assets/amazeui.widgets.helper.js"></script>
    <script src="/js/assets/amazeui.ie8polyfill.min.js"></script>
    <script src="/js/assets/amazeui.ie8polyfill.js"></script>
    <script src="/js/assets/amazeui.min.js"></script>
    <script src="/js/assets/amazeui.js"></script>

    <link rel="stylesheet" type="text/css" href="/css/assets/amazeui.min.css">
    <link rel="stylesheet" type="text/css" href="/css/assets/amazeui.css">

    <style>
        .topImg{
            padding:5px;
        }
        .title{
            font-size: 12px;
        }
        .more{
            text-align: right;
        }
        .more a{
            color:gray;
        }
        .titleImg{
            height: 50px;
            width:100px;
        }
        li{
            list-style: none;
        }
        hr{
            margin: 2px;
        }
    </style>
</head>
<body>
    <div data-am-widget="slider" class="am-slider am-slider-default" data-am-slider='{}' >
        <ul class="am-slides" id="lunbo">
        </ul>
    </div>
    <div>
        <ul class="am-avg-sm-3 boxes" data-am-widget="navbar">
            <li class="box box-1" data-am-navbar-share>
                <a href="#">
                    <span class="am-icon-user-md am-icon-lg"></span>
                    <span class="am-navbar-label"><br>课程学习</span>
                </a>
            </li>
            <li class="box box-2" data-am-navbar-share>
                <a href="###">
                    <span class="am-icon-user-md am-icon-lg"></span>
                    <span class="am-navbar-label"><br>参加考试</span>
                </a>
            </li>
            <li class="box box-2" data-am-navbar-share>
                <a href="###">
                    <span class="am-icon-user-md am-icon-lg"></span>
                    <span class="am-navbar-label"><br>发布考试</span>
                </a>
            </li>
        </ul>
    </div>
    <div>
        <div class="am-g">
            <div class="am-u-sm-6">推荐</div>
            <div class="am-u-sm-6 more">
                <a href="turnRecommend">
                    查看更多
                </a>
            </div>
        </div>
        <br>
        <div id="totalStudy">

        </div>
    </div>
    <div class="topImg">
        <img src="images/1.jpg" height="200px"width="100%">
    </div>
    <div>
        <div class="am-g">
            <div class="am-u-sm-6">最新</div>
            <div class="am-u-sm-6 more">
                <a href="/turnCateGory">
                    查看更多
                </a>
            </div>
        </div>
        <br>
        <div id="newStudy">

        </div>
    </div>

</body>
<script>
    //轮播
    $.ajax({
        type:"get",//访问url类型（get,post）
        url:"getLunbo",//url地址
        async:false,//是否异步加载，true为异步加载，false为同步加载
        data : {
        },//发送数据
        dataType : "text",//数据类型
        success :function(result){//成功返回
            result=eval("("+result+")");
            console.log(result);
            var lunbo=document.getElementById("lunbo");
            for(var i=0;i<result.length;i++){
                var li=document.createElement("li");
                li.innerHTML+="<a href='/getDetail?type="+result[i][0]+"'>";
                li.innerHTML+="<img src='"+result[i][1]+"'/>";
                li.innerHTML+="</a>";
                lunbo.appendChild(li);
            }
        },
        error : function(errorMsg) {//返回失败

        }
    });

    //最新
    $.ajax({
        type:"get",//访问url类型（get,post）
        url:"getThreeNew",//url地址
        async:false,//是否异步加载，true为异步加载，false为同步加载
        data : {
        },//发送数据
        dataType : "text",//数据类型
        success :function(result){//成功返回
            result=eval("("+result+")");
            console.log(result);
            var newStudy=document.getElementById("newStudy");
            for(var i=0;i<result.length;i++){
                var li=document.createElement("li");
                li.innerHTML=
                    "<a href='/getStudyDetail?id="+result[i][0]+"' >" +
                        "<div class='am-g'>" +
                            "<div class='am-u-sm-8'>" +
                                "<div class='title'>"+result[i][1]+"" +
                                    "<p class='detail'>"+result[i][2]+"&nbsp;&nbsp;&nbsp;阅读数："+result[i][4]+"</p>" +
                                "</div>" +
                            "</div>" +
                            "<div class='am-u-sm-4'>" +
                                "<img src='"+result[i][3]+"' class='titleImg'/>" +
                            "</div>" +
                        "</div>" +
                    "</a>" +
                    "<hr>";
                newStudy.appendChild(li);
            }
        },
        error : function(errorMsg) {//返回失败

        }
    });

    //推荐
    $.ajax({
        type:"get",//访问url类型（get,post）
        url:"getThreeMaxTotal",//url地址
        async:false,//是否异步加载，true为异步加载，false为同步加载
        data : {
        },//发送数据
        dataType : "text",//数据类型
        success :function(result){//成功返回
            result=eval("("+result+")");
            console.log(result);
            var totalStudy=document.getElementById("totalStudy");
            for(var i=0;i<result.length;i++){
                var li=document.createElement("li");
                li.innerHTML=
                    "<a href='/getStudyDetail?id="+result[i][0]+"'>" +
                        "<div class='am-g'>" +
                            "<div class='am-u-sm-8'>" +
                                "<div class='title'>"+result[i][1]+"" +
                                    "<p class='detail'>"+result[i][2]+"&nbsp;&nbsp;&nbsp;阅读数："+result[i][4]+"</p>" +
                                "</div>" +
                            "</div>" +
                            "<div class='am-u-sm-4'>" +
                                "<img src='"+result[i][3]+"' class='titleImg'/>" +
                            "</div>" +
                        "</div>" +
                    "</a>" +
                    "<hr>";
                totalStudy.appendChild(li);
            }
        },
        error : function(errorMsg) {//返回失败

        }
    });
</script>
</html>